<? 	include("top.php");	
$userid = $_SESSION["userid"];
?>
<table width="100%"  border="0" cellspacing="0" cellpadding="20">
      <tr>
        <td><p>Project time</p>
          <form name="form1" method="get" action="">
            <label for="txtDate" ></label>
            <input type="text" name="txtDate" value="<?=$_GET["txtDate"]?$_GET["txtDate"]:date("Y-m-d");?>" id="txtDate">
            <input type="submit" name="button" id="button" value="Submit">
          </form>
          <p>&nbsp;</p>
		  <form name="form2" method="post" action="">
		    <? 
		if($_GET["txtDate"])$qDate = $_GET["txtDate"];
		else $qDate = date("Y-m-d");
		
		//delete
		if($_POST["delete"])
		{
			$ids = $_POST["del"];
			foreach($ids as $id)
			{
				mysql_query("delete from item_hour where id=$id");
			}
		}
		
		$sql = "SELECT item_hour.id, items.unique_id, items.name, items.estimate, item_hour.estimate, item_hour.remaining, item_hour.spent, item_hour.dt, item_hour.note, from_time, to_time FROM `item_hour`,items WHERE `dt`='".$qDate."' and item_hour.userid=$userid and item_hour.itemid=items.id";
		
		$deletable = true;
		$delCheck = "<input type=checkbox name=del[] value=TABLEID>";
		if((time()-strtotime($qDate))/24/3600>7)$delCheck="";
		//if()
		table($sql,  $delCheck); ?>
	        <br>
	        <input type="submit" name="delete" id="delete" value="Delete Selected">
          </form>

		  <!--
		This should show the project time of today.
		Oh, it should also be possible to show project time of another day.
		
		//Checkout the table for the same.
		-->
	    </p></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
